﻿using Enterprise.Model;
using Enterprise.Contract;
using Enterprise.Dal;
using System.Data;

namespace Enterprise.Bll.Implement
{
    public class ImplNews:INews{

        private readonly DNews dal = new DNews();
         /// <summary>
        ///  根据文章类型获取前N条文章列表
        /// </summary>
        /// <param name="ArticleTypeID">文章类型</param>
        /// <param name="topNum">前N条记录</param>
        /// <returns></returns>
        public DataTable GetArticleList(int ArticleTypeID, int topNum)
        {
            return dal.GetArticleList(ArticleTypeID, topNum);
        }
           /// <summary>
        /// 新闻分页
        /// </summary>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">每页显示条数</param>
        /// <param name="totalPage">总页数</param>
        /// <param name="totalRecord">总记录数</param>
        /// <returns></returns>
        public DataTable GetNewList(int pageIndex, int pageSize, out int totalPage, out int totalRecord, string strWhere)
        {
            return dal.GetNewList(pageIndex, pageSize, out totalPage, out totalRecord, strWhere);
        }
          /// <summary>
        /// 获取新闻详细
        /// </summary>
        /// <param name="newsID"></param>
        /// <returns></returns>
        public DataTable GetNewsDetail(int newsID)
        {
            return dal.GetNewsDetail(newsID);
        }
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int ArticleID)
        {
            return dal.Exists(ArticleID);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Enterprise.Model.News model)
        {
            return dal.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Enterprise.Model.News model)
        {
            dal.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public void Delete(int ArticleID)
        {
            dal.Delete(ArticleID);
        }
    }
}